home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / 93win / data1.cab / DLL_Toolkit / Source / HTBKnob / HTBknob.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2005-03-02  |  2.0 KB  |  93 lines

  1. /***************************************
  2. HTBKnob.dll
  3.  
  4. HTBknob.cpp
  5.  
  6. Copyright TransEra Corporation 1999
  7. ***************************************/
  8.  
  9. #include "stdafx.h"
  10. #include "HTBknob.h"
  11. #include "DialogThread.h"
  12. #include "KnobDlg.h"
  13.  
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19.  
  20. short g_Xpos;
  21. short g_Ypos;
  22. long * g_pBasicVar;
  23. long * RetVal;
  24. KnobDlg * g_KnobVar;
  25.  
  26. BEGIN_MESSAGE_MAP(CHTBknobApp, CWinApp)
  27.     //{{AFX_MSG_MAP(CHTBknobApp)
  28.         // NOTE - the ClassWizard will add and remove mapping macros here.
  29.         //    DO NOT EDIT what you see in these blocks of generated code!
  30.     //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32.  
  33.  
  34. CHTBknobApp::CHTBknobApp() 
  35. {
  36. }
  37.  
  38. CHTBknobApp theApp;
  39.  
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. /*
  43.     Function:        Knob
  44.  
  45.     Description:    Initializes pointers and passes corrrect data into funtion.    
  46.  
  47.     Return type:    void 
  48.     Argument:        long* pBasicVar
  49.     Argument:        long* ShortPtr
  50.     Argument:        short xpos
  51.     Argument:        short ypos
  52.  
  53.     Notes:            Initializes the starting positions of the dialog window
  54.                     Starts a new thread and is the passage of data from the 
  55.                     knob back to HTBasic.
  56.         
  57. */
  58. void Knob(long* pBasicVar, long* ShortPtr, short xpos, short ypos) 
  59. {
  60.     g_Xpos = xpos;
  61.     g_Ypos = ypos;
  62.     
  63.     if (g_KnobVar == NULL) 
  64.     {
  65.         g_pBasicVar = pBasicVar;
  66.         RetVal = ShortPtr;
  67.         CWinThread * pThread = AfxBeginThread(RUNTIME_CLASS (DialogThread));    // create thread to execute dialog
  68.     }
  69. }
  70.  
  71.  
  72. /////////////////////////////////////////////////////////////////////////////
  73. /*
  74.     Function:        Closeknob
  75.  
  76.     Description:    Closes Dialog Box    
  77.  
  78.     Return type:    void 
  79.  
  80.     Notes:            Closes dialog box and shuts down CLEANLY the worker thread
  81.                     that it was running on.
  82. */
  83. void Closeknob() 
  84. {    
  85.     if (g_KnobVar != NULL) 
  86.     {    
  87.         g_KnobVar->KillTimer(1);            // stop timer from updating dialog
  88.         g_KnobVar->EndDialog(1);            // tell dialog to end
  89.         g_KnobVar = NULL;                    // set pointer to NULL to show no dialog running (dialog is still shutting down)
  90.         
  91.     }
  92. }
  93.